document.write("<script language=javascript src='static/ku/jQuery/jquery.min.js'></script>");
class zjm {
    ip = "localhost";
    port = "8080";
    deal = "http";
    urlInfo = "/novel";
    address() {
        // var address = this.deal + "://" + this.ip + ":" + this.port + this.urlInfo;
        var address = "";
        return address;
    }
    ax(methods, url, data = null, callback, other = null) {
        if (other == null) {
            $.ajax({
                method: methods == "get" || methods == "GET" ? "get" : "post",
                url: this.address() + url,
                headers: {
                    "Content-Type": "application/json"
                },
                data: data,
                success: function (res) {
                    callback(res);
                },
                error: function (xhr, status, error) {
                    callback(xhr, status, error);
                    // console.error("请求失败：", error);
                    // alert("发生错误：" + (xhr.responseJSON?.message || "未知错误"));
                },
            });
        } else if (other == "file") {
            $.ajax({
                method: methods == "get" || methods == "GET" ? "get" : "post",
                url: this.address() + url,
                data: data,
                cache: false,
                processData: false,
                contentType: false,
                success: function (res) {
                    callback(res);
                }
            });
        }
    }
}